﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;
using System.Runtime.InteropServices;

namespace BuildEvents
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args[0] == @"-i")
            {
                var dte = (DTE)Marshal.GetActiveObject("VisualStudio.DTE.10.0");
                var solutionWindow = dte.Windows.Item("{3AE79031-E1BC-11D0-8F78-00A0C9110057}");

                System.Threading.Thread.Sleep(100);

                solutionWindow.Object.GetItem(@"SolutionFramework\SolutionFramework.Web\ImageService.svc").Select(vsUISelectionType.vsUISelectionTypeSelect);
                dte.ExecuteCommand("Project.IncludeInProject");
            }
            else if (args[0] == @"-e")
            {
                var dte = (DTE)Marshal.GetActiveObject("VisualStudio.DTE.10.0");

                dte.Windows.Item("{3AE79031-E1BC-11D0-8F78-00A0C9110057}").Activate();
                dte.ActiveWindow.Object.GetItem(@"SolutionFramework\SolutionFramework.Web\ImageService.svc").Select(vsUISelectionType.vsUISelectionTypeSelect);
                dte.ExecuteCommand("Project.ExcludeFromProject");
            }
        }
    }
}
